<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>小说创作平台 - 作者中心</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Microsoft YaHei', sans-serif;
    }

    body {
      background-color: #f5f7fa;
      color: #333;
      line-height: 1.6;
    }

    .container {
      width: 90%;
      max-width: 1200px;
      margin: 0 auto;
      background: white;
      border-radius: 10px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      min-height: 100vh;
    }

    header {
      background: linear-gradient(to right, #8E44AD, #9B59B6);
      color: white;
      padding: 20px 0;
      text-align: center;
      position: relative;
    }

    .logo {
      font-size: 2rem;
      font-weight: bold;
      margin-bottom: 5px;
    }

    .user-section {
      position: absolute;
      top: 20px;
      right: 20px;
      display: flex;
      align-items: center;
    }

    .user-info {
      margin-right: 15px;
    }

    .username {
      font-weight: 500;
    }

    .btn {
      padding: 8px 15px;
      border: none;
      border-radius: 20px;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      font-size: 0.9rem;
    }

    .btn-logout {
      background: #f44336;
      color: white;
    }

    .btn-primary {
      background: linear-gradient(to right, #8E44AD, #9B59B6);
      color: white;
    }

    nav {
      background: linear-gradient(to right, #8E44AD, #9B59B6);
      padding: 10px 0;
    }

    .nav-links {
      display: flex;
      justify-content: center;
      list-style: none;
      flex-wrap: wrap;
    }

    .nav-links li {
      margin: 5px 10px;
    }

    .nav-links a {
      color: white;
      text-decoration: none;
      font-size: 1rem;
      font-weight: 500;
      padding: 8px 20px;
      border-radius: 20px;
      transition: all 0.3s ease;
    }

    .nav-links a:hover,
    .nav-links a.active {
      background: rgba(255, 255, 255, 0.2);
    }

    .section {
      display: none;
      padding: 30px;
    }

    .section.active {
      display: block;
    }

    /* 小说章节查询样式 */
    .search-container {
      width: 90%;
      max-width: 800px;
      margin: 0 auto;
      padding: 20px 0;
    }

    h2 {
      color: #8E44AD;
      text-align: center;
      margin-bottom: 20px;
      font-size: 1.8rem;
    }

    .section-title {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 20px;
    }

    .section-title i {
      font-size: 1.5rem;
      margin-right: 10px;
    }

    .form-group {
      margin-bottom: 15px;
    }

    input, select, textarea {
      width: 100%;
      padding: 12px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 1rem;
      margin-bottom: 10px;
    }

    .btn-submit {
      background: linear-gradient(to right, #8E44AD, #9B59B6);
      color: white;
      font-size: 1rem;
      padding: 12px;
      margin-top: 10px;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.3s ease;
    }

    .btn-submit:hover {
      opacity: 0.9;
      transform: translateY(-2px);
    }

    .author-info {
      background: #f8f9fa;
      border-radius: 8px;
      padding: 15px;
      margin: 20px auto;
      max-width: 500px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .author-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 15px;
      margin-top: 20px;
    }

    .stat-card {
      background: white;
      border-radius: 8px;
      padding: 15px;
      text-align: center;
      box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    }

    .stat-number {
      font-size: 1.8rem;
      font-weight: bold;
      color: #8E44AD;
      margin: 10px 0;
    }

    .stat-label {
      color: #666;
      font-size: 0.9rem;
    }

    /* 书籍网格 */
    .books-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 20px;
      margin-top: 30px;
    }

    .book-card {
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
    }

    .book-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

    .book-image {
      height: 180px;
      background: linear-gradient(45deg, #8E44AD, #9B59B6);
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 3.5rem;
    }

    .book-info {
      padding: 15px;
    }

    .book-title {
      font-size: 1.1rem;
      margin-bottom: 5px;
      font-weight: bold;
    }

    .book-author {
      color: #666;
      font-size: 0.9rem;
      margin-bottom: 5px;
    }

    .book-chapters {
      color: #555;
      font-size: 0.85rem;
      margin-top: 5px;
    }

    .book-actions {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;
    }

    .action-btn {
      background: #f0f2f5;
      border: none;
      border-radius: 4px;
      padding: 5px 10px;
      font-size: 0.8rem;
      cursor: pointer;
      transition: all 0.2s;
    }

    .action-btn:hover {
      background: #e0e2e5;
    }

    /* 小说更新模块 */
    .update-form-container {
      width: 90%;
      max-width: 800px;
      margin: 0 auto;
      background: white;
      padding: 25px;
      border-radius: 10px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    }

    /* 章节列表 */
    .chapters-list {
      margin-top: 30px;
    }

    .chapter-item {
      background: white;
      border-radius: 8px;
      padding: 15px;
      margin: 10px 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-left: 4px solid #8E44AD;
      transition: all 0.3s ease;
    }

    .chapter-item:hover {
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    }

    .chapter-info {
      flex: 1;
    }

    .chapter-title {
      font-weight: bold;
      margin-bottom: 5px;
      color: #8E44AD;
    }

    .chapter-meta {
      font-size: 0.85rem;
      color: #666;
    }

    .chapter-actions {
      display: flex;
      gap: 10px;
    }

    .edit-btn {
      background: #e0f7fa;
      color: #00838f;
    }

    .delete-btn {
      background: #ffebee;
      color: #c62828;
    }

    /* 读者信息管理 */
    .readers-section {
      margin-top: 30px;
      max-width: 1000px;
      margin: 30px auto 0;
    }

    .comment-card {
      background: #f9f9f9;
      border-radius: 8px;
      padding: 15px;
      margin: 15px 0;
      border-left: 4px solid #8E44AD;
    }

    .comment-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 8px;
      color: #666;
      font-size: 0.9rem;
    }

    .comment-novel {
      font-weight: 500;
    }

    .comment-content {
      font-size: 1rem;
      line-height: 1.5;
      margin-bottom: 10px;
    }

    .reply-section {
      margin-top: 10px;
      display: flex;
    }

    .reply-input {
      flex: 1;
      padding: 8px;
      border: 1px solid #ddd;
      border-radius: 4px;
    }

    .reply-btn {
      background: #8E44AD;
      color: white;
      border: none;
      border-radius: 4px;
      padding: 8px 15px;
      margin-left: 10px;
      cursor: pointer;
    }

    .message {
      padding: 12px;
      border-radius: 6px;
      margin: 15px 0;
      text-align: center;
      font-weight: bold;
    }

    .success {
      background: #e8f5e9;
      color: #2e7d32;
    }

    .error {
      background: #ffebee;
      color: #c62828;
    }

    .author-note {
      background: #e8f5e9;
      border-left: 4px solid #4CAF50;
      padding: 12px;
      margin: 10px 0;
      font-size: 0.9rem;
    }

    @media (max-width: 768px) {
      .nav-links {
        justify-content: flex-start;
      }
      
      .nav-links li {
        margin: 5px;
      }
      
      .update-form-container, 
      .search-container {
        width: 95%;
        padding: 15px;
      }
      
      .chapter-actions {
        flex-direction: column;
        align-items: flex-end;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <header>
      <div class="logo">小说创作平台</div>
      <p>作者中心</p>
      <div class="user-section">
        <div class="user-info">
          <span class="username">作者：天蚕土豆</span>
        </div>
        <button id="logoutBtn" class="btn btn-logout">退出登录</button>
      </div>
    </header>

    <nav>
      <ul class="nav-links">
        <li><a href="#" class="nav-link active" data-target="search">小说章节查询</a></li>
        <li><a href="#" class="nav-link" data-target="update">小说更新模块</a></li>
        <li><a href="#" class="nav-link" data-target="readers">读者信息管理</a></li>
      </ul>
    </nav>

    <!-- 小说章节查询部分 -->
    <section id="search" class="section active">
      <div class="search-container">
        <div class="section-title">
          <i class="fas fa-book"></i>
          <h2>小说章节查询</h2>
        </div>
        
        <div class="author-info">
          <h3 style="text-align: center; margin-bottom: 15px;">创作数据概览</h3>
          <div class="author-stats">
            <div class="stat-card">
              <div class="stat-number">3</div>
              <div class="stat-label">连载中作品</div>
            </div>
            <div class="stat-card">
              <div class="stat-number">12</div>
              <div class="stat-label">已完结作品</div>
            </div>
            <div class="stat-card">
              <div class="stat-number">1853</div>
              <div class="stat-label">总章节数</div>
            </div>
            <div class="stat-card">
              <div class="stat-number">45万</div>
              <div class="stat-label">追更读者</div>
            </div>
          </div>
        </div>
        
        <div class="form-group">
          <input type="text" id="searchInput" placeholder="输入小说名称">
        </div>
        <button class="btn-submit" id="searchBtn">搜索</button>
      </div>

      <div style="margin: 30px auto; max-width: 1000px;">
        <h3 style="text-align: center; margin-bottom: 20px; color: #8E44AD;">我的作品</h3>
        <div class="books-grid" id="searchResults">
          <div class="book-card">
            <div class="book-image">📚</div>
            <div class="book-info">
              <div class="book-title">斗破苍穹</div>
              <div class="book-author">作者：天蚕土豆</div>
              <div class="book-chapters">最新章节：第1652章 结束，也是开始</div>
              <div class="book-meta">状态：已完结</div>
              <div class="book-meta">字数：532万字</div>
              <div class="book-actions">
                <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 管理</button>
                <button class="action-btn edit-btn"><i class="fas fa-plus"></i> 更新</button>
              </div>
            </div>
          </div>
          <div class="book-card">
            <div class="book-image">📖</div>
            <div class="book-info">
              <div class="book-title">武动乾坤</div>
              <div class="book-author">作者：天蚕土豆</div>
              <div class="book-chapters">最新章节：第1324章 新的开始</div>
              <div class="book-meta">状态：已完结</div>
              <div class="book-meta">字数：394万字</div>
              <div class="book-actions">
                <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 管理</button>
                <button class="action-btn edit-btn"><i class="fas fa-plus"></i> 更新</button>
              </div>
            </div>
          </div>
          <div class="book-card">
            <div class="book-image">🖋️</div>
            <div class="book-info">
              <div class="book-title">大主宰</div>
              <div class="book-author">作者：天蚕土豆</div>
              <div class="book-chapters">最新章节：第1587章 大结局</div>
              <div class="book-meta">状态：已完结</div>
              <div class="book-meta">字数：498万字</div>
              <div class="book-actions">
                <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 管理</button>
                <button class="action-btn edit-btn"><i class="fas fa-plus"></i> 更新</button>
              </div>
            </div>
          </div>
          <div class="book-card">
            <div class="book-image">📓</div>
            <div class="book-info">
              <div class="book-title">元尊</div>
              <div class="book-author">作者：天蚕土豆</div>
              <div class="book-chapters">最新章节：第1525章 大结局</div>
              <div class="book-meta">状态：已完结</div>
              <div class="book-meta">字数：476万字</div>
              <div class="book-actions">
                <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 管理</button>
                <button class="action-btn edit-btn"><i class="fas fa-plus"></i> 更新</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 小说更新模块 -->
    <section id="update" class="section">
      <div class="update-form-container">
        <div class="section-title">
          <i class="fas fa-feather-alt"></i>
          <h2>更新小说章节</h2>
        </div>
        
        <div class="message success">
          请选择需要更新的小说，您可以新建章节或编辑已有章节内容
        </div>
        
        <div id="updateMessage" class="message" style="display: none;"></div>
        
        <div class="form-group">
          <label for="updateNovelSelect">选择小说</label>
          <select id="updateNovelSelect">
            <option value="">--请选择小说--</option>
            <option value="斗破苍穹">斗破苍穹</option>
            <option value="武动乾坤">武动乾坤</option>
            <option value="大主宰">大主宰</option>
            <option value="元尊">元尊</option>
          </select>
        </div>
        
        <div class="form-group">
          <label for="chapterTitle">章节标题</label>
          <input type="text" id="chapterTitle" placeholder="输入章节标题" required>
        </div>
        
        <div class="form-group">
          <label for="chapterNumber">章节序号</label>
          <input type="number" id="chapterNumber" min="1" placeholder="输入章节序号">
        </div>
        
        <div class="form-group">
          <label for="chapterContent">章节内容</label>
          <textarea id="chapterContent" rows="10" placeholder="输入章节内容..." required></textarea>
        </div>
        
        <div class="author-note">
          <i class="fas fa-lightbulb"></i> 提示：章节发布后，系统会自动通知追更的读者
        </div>
        
        <div style="display: flex; gap: 15px; margin-top: 20px;">
          <button class="btn-submit" id="saveChapterBtn">保存草稿</button>
          <button class="btn-submit" id="publishChapterBtn">立即发布</button>
        </div>
      </div>
      
      <div class="update-form-container">
        <div class="section-title">
          <i class="fas fa-list"></i>
          <h3>章节管理</h3>
        </div>
        
        <div class="form-group">
          <input type="text" id="filterChapters" placeholder="筛选章节">
        </div>
        
        <div class="chapters-list" id="chaptersList">
          <div class="chapter-item">
            <div class="chapter-info">
              <div class="chapter-title">第1586章 决战来临</div>
              <div class="chapter-meta">小说：大主宰 · 状态：已发布 · 字数：2456 · 发布时间：2023-11-20</div>
            </div>
            <div class="chapter-actions">
              <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 编辑</button>
              <button class="action-btn delete-btn"><i class="fas fa-trash"></i> 删除</button>
            </div>
          </div>
          <div class="chapter-item">
            <div class="chapter-info">
              <div class="chapter-title">第1585章 最终准备</div>
              <div class="chapter-meta">小说：大主宰 · 状态：已发布 · 字数：1987 · 发布时间：2023-11-18</div>
            </div>
            <div class="chapter-actions">
              <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 编辑</button>
              <button class="action-btn delete-btn"><i class="fas fa-trash"></i> 删除</button>
            </div>
          </div>
          <div class="chapter-item">
            <div class="chapter-info">
              <div class="chapter-title">第1584章 风云再起</div>
              <div class="chapter-meta">小说：大主宰 · 状态：草稿 · 字数：1562 · 最后修改：2023-11-15</div>
            </div>
            <div class="chapter-actions">
              <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 编辑</button>
              <button class="action-btn delete-btn"><i class="fas fa-trash"></i> 删除</button>
            </div>
          </div>
          <div class="chapter-item">
            <div class="chapter-info">
              <div class="chapter-title">第1590章 尾声</div>
              <div class="chapter-meta">小说：大主宰 · 状态：草稿 · 字数：3210 · 最后修改：2023-11-10</div>
            </div>
            <div class="chapter-actions">
              <button class="action-btn edit-btn"><i class="fas fa-edit"></i> 编辑</button>
              <button class="action-btn delete-btn"><i class="fas fa-trash"></i> 删除</button>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 读者信息管理部分 -->
    <section id="readers" class="section">
      <div class="update-form-container">
        <div class="section-title">
          <i class="fas fa-users"></i>
          <h2>读者信息管理</h2>
        </div>
        
        <div class="message">
          <i class="fas fa-info-circle"></i> 您可以在这里查看读者留言并进行回复，与读者互动交流
        </div>
      </div>
      
      <div class="readers-section">
        <h3 style="text-align: center; margin: 20px 0 30px; color: #8E44AD;">读者留言与评论</h3>
        <div id="commentsList">
          <div class="comment-card">
            <div class="comment-header">
              <div class="comment-novel">[斗破苍穹] · 读者：小说爱好者</div>
              <div>2023-11-20 14:30</div>
            </div>
            <div class="comment-content">
              萧炎这个角色塑造得太成功了，从废柴到强者，这种逆袭的故事永远让人热血沸腾！
            </div>
            <div class="reply-section">
              <input type="text" class="reply-input" placeholder="回复读者...">
              <button class="reply-btn">发送</button>
            </div>
          </div>
          
          <div class="comment-card">
            <div class="comment-header">
              <div class="comment-novel">[大主宰] · 读者：书虫123</div>
              <div>2023-11-19 21:15</div>
            </div>
            <div class="comment-content">
              决战章节非常精彩，不过我觉得牧尘赢得太轻松了，有点不够过瘾，建议增加一些曲折。
            </div>
            <div class="reply-section">
              <input type="text" class="reply-input" placeholder="回复读者...">
              <button class="reply-btn">发送</button>
            </div>
          </div>
          
          <div class="comment-card">
            <div class="comment-header">
              <div class="comment-novel">[元尊] · 读者：追更达人</div>
              <div>2023-11-18 09:42</div>
            </div>
            <div class="comment-content">
              周元的成长过程描写得很细致，但最近的剧情节奏有点慢，希望加快更新速度！等不及看结局了。
            </div>
            <div class="author-reply">
              <div class="author-note">
                <strong>作者回复：</strong> 感谢您的反馈！由于最近在构思新书大纲，更新速度稍慢。下周起会恢复每日两更！敬请期待！
              </div>
            </div>
          </div>
          
          <div class="comment-card">
            <div class="comment-header">
              <div class="comment-novel">[武动乾坤] · 读者：老书迷</div>
              <div>2023-11-17 16:20</div>
            </div>
            <div class="comment-content">
              林动的性格刻画太棒了，坚毅重情，为朋友两肋插刀，最喜欢的角色之一！
            </div>
            <div class="reply-section">
              <input type="text" class="reply-input" placeholder="回复读者...">
              <button class="reply-btn">发送</button>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>

  <script>
    // 导航切换功能
    document.querySelectorAll('.nav-link').forEach(link => {
      link.addEventListener('click', function (e) {
        e.preventDefault();

        // 移除所有活动状态
        document.querySelectorAll('.nav-link').forEach(link => {
          link.classList.remove('active');
        });
        document.querySelectorAll('.section').forEach(section => {
          section.classList.remove('active');
        });

        // 添加当前活动状态
        this.classList.add('active');
        const target = this.getAttribute('data-target');
        document.getElementById(target).classList.add('active');
      });
    });

    // 退出登录功能
    document.getElementById('logoutBtn').addEventListener('click', function() {
      if(confirm('确定要退出登录吗？')) {
        window.location.href = 'index.html';
      }
    });

    // 搜索功能
    document.getElementById('searchBtn').addEventListener('click', function() {
      const query = document.getElementById('searchInput').value;
      
      if(!query) {
        alert('请输入搜索内容');
        return;
      }
      
      // 显示加载状态
      const searchBtn = this;
      const originalText = searchBtn.textContent;
      searchBtn.textContent = '搜索中...';
      searchBtn.disabled = true;
      
      // 模拟搜索过程
      setTimeout(() => {
        searchBtn.textContent = originalText;
        searchBtn.disabled = false;
        alert(`搜索 "${query}" 完成，显示结果在页面中`);
      }, 800);
    });

    // 发布章节功能
    document.getElementById('publishChapterBtn').addEventListener('click', function() {
      const novel = document.getElementById('updateNovelSelect').value;
      const title = document.getElementById('chapterTitle').value;
      const content = document.getElementById('chapterContent').value;
      
      if(!novel || !title || !content) {
        showMessage('updateMessage', '请填写完整信息', 'error');
        return;
      }
      
      // 模拟发布
      this.textContent = '发布中...';
      this.disabled = true;
      
      setTimeout(() => {
        this.textContent = '立即发布';
        this.disabled = false;
        showMessage('updateMessage', `《${title}》章节发布成功！已通知读者！`, 'success');
      }, 1200);
    });

    // 保存草稿功能
    document.getElementById('saveChapterBtn').addEventListener('click', function() {
      const novel = document.getElementById('updateNovelSelect').value;
      const title = document.getElementById('chapterTitle').value;
      const content = document.getElementById('chapterContent').value;
      
      if(!title || !content) {
        showMessage('updateMessage', '请填写章节标题和内容', 'error');
        return;
      }
      
      // 模拟保存
      this.textContent = '保存中...';
      this.disabled = true;
      
      setTimeout(() => {
        this.textContent = '保存草稿';
        this.disabled = false;
        showMessage('updateMessage', `《${title}》草稿已保存成功！`, 'success');
      }, 800);
    });

    // 显示消息函数
    function showMessage(elementId, msg, type) {
      const message = document.getElementById(elementId);
      message.textContent = msg;
      message.style.display = 'block';
      message.className = `message ${type}`;
      
      // 3秒后自动隐藏
      setTimeout(() => {
        message.style.display = 'none';
      }, 3000);
    }

    // 章节编辑和删除功能
    document.querySelectorAll('.chapter-actions .edit-btn').forEach(btn => {
      btn.addEventListener('click', function() {
        const chapterTitle = this.closest('.chapter-item').querySelector('.chapter-title').textContent;
        alert(`进入编辑模式：${chapterTitle} \n在实际应用中，将跳转到编辑页面`);
      });
    });

    document.querySelectorAll('.chapter-actions .delete-btn').forEach(btn => {
      btn.addEventListener('click', function() {
        const chapterItem = this.closest('.chapter-item');
        const chapterTitle = chapterItem.querySelector('.chapter-title').textContent;
        if(confirm(`确定要删除章节：${chapterTitle}吗？`)) {
          chapterItem.style.opacity = 0.5;
          setTimeout(() => {
            chapterItem.remove();
          }, 500);
        }
      });
    });

    // 回复读者评论
    document.querySelectorAll('.reply-btn').forEach(btn => {
      btn.addEventListener('click', function() {
        const replyInput = this.previousElementSibling;
        const comment = replyInput.value;
        if(!comment) {
          alert('请输入回复内容');
          return;
        }
        
        this.textContent = '发送中...';
        
        setTimeout(() => {
          this.textContent = '发送';
          replyInput.value = '';
          
          // 添加回复到页面
          const replySection = document.createElement('div');
          replySection.className = 'author-reply';
          replySection.innerHTML = `
            <div class="author-note">
              <strong>作者回复：</strong> ${comment}
            </div>
          `;
          
          this.closest('.comment-card').appendChild(replySection);
        }, 800);
      });
    });
  </script>
</body>
</html>